package com.feisi.service.impl;

import com.feisi.dao.ContractDao;
import com.feisi.domain.Contract;
import com.feisi.service.ContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ContractServiceImpl implements ContractService {

    @Autowired
    private ContractDao contractDao;

    @Override
    public List<Contract> findAll(Integer page, Integer limit) {
        List<Contract> contracts = contractDao.findAll(page, limit);
        return contracts;
    }

    @Override
    public Integer contractsTotal() {
        Integer contractsTotal = contractDao.contractsTotal();
        return contractsTotal;
    }

    @Override
    public List<Contract> findByName(String co_name, Integer page, Integer limit) {
        List<Contract> contracts = contractDao.findByName(co_name, page, limit);
        return contracts;
    }

    @Override
    public Integer contractsTotalByName(String co_name) {
        Integer contractsTotalByName = contractDao.contractsTotalByName(co_name);
        return contractsTotalByName;
    }

    @Override
    public List<Contract> findByStatus(String co_status, Integer page, Integer limit) {
        List<Contract> contracts = contractDao.findByStatus(co_status,page,limit);
        return contracts;
    }

    @Override
    public Integer contractsTotalByStatus(String co_status) {
        Integer contractsTotalByStatus = contractDao.contractsTotalByStatus(co_status);
        return contractsTotalByStatus;
    }

    @Override
    public void saveContract(Contract contract) {
        contractDao.saveContract(contract);
    }

    @Override
    public void deleteContract(Integer[] ids) {
        contractDao.deleteContract(ids);
    }

    @Override
    public void updateStatus(Integer id,String status) {
        contractDao.updateStatus(id,status);
    }
}
